﻿namespace Onvif.WebApi.Common
{
    public static class Constant
    {
        public const string PROBE_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <e:Envelope xmlns:e=""http://www.w3.org/2003/05/soap-envelope""
                    xmlns:w=""http://schemas.xmlsoap.org/ws/2004/08/addressing""
                    xmlns:d=""http://schemas.xmlsoap.org/ws/2005/04/discovery""
                    xmlns:tds=""https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl""
                    xmlns:dn=""http://www.onvif.org/ver10/network/wsdl"">
            <e:Header>
                <w:MessageID>uuid:{0}</w:MessageID>
                <w:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To>
                <w:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action>
            </e:Header>
            <e:Body>
                <d:Probe><d:Types>dn:NetworkVideoTransmitter</d:Types></d:Probe>
            </e:Body>
        </e:Envelope>";

        public const string PATTERN = @"^((onvif[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$";

        public const string CAPABILITIES_QUERY_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
			        xmlns:tds=""http://www.onvif.org/ver10/device/wsdl"" 
			        xmlns:tt=""http://www.onvif.org/ver10/schema"">
        	<s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
        		<wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""
        					   xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
        			<wsse:UsernameToken>
        				<wsse:Username>{0}</wsse:Username>
        				<wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
        				<wsse:Nonce>{2}</wsse:Nonce> 
        				<wsu:Created>{3}</wsu:Created>
        			</wsse:UsernameToken>
        		</wsse:Security>
        	</s:Header>
        	<s:Body>
                <GetCapabilities xmlns=""http://www.onvif.org/ver10/device/wsdl"">
                    <Category>All</Category>
                </GetCapabilities>
        	</s:Body>
        </s:Envelope>";

        public const string PROFILES_QUERY_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
			        xmlns:tds=""http://www.onvif.org/ver{4}/device/wsdl"" 
			        xmlns:tt=""http://www.onvif.org/ver{4}/schema"">
        	<s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
        		<wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""
        					   xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
        			<wsse:UsernameToken>
        				<wsse:Username>{0}</wsse:Username>
        				<wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
        				<wsse:Nonce>{2}</wsse:Nonce> 
        				<wsu:Created>{3}</wsu:Created>
        			</wsse:UsernameToken>
        		</wsse:Security>
        	</s:Header>
        	<s:Body>
        		<GetProfiles xmlns=""http://www.onvif.org/ver{4}/media/wsdl"">
        			<Type>All</Type>
        		</GetProfiles>
        	</s:Body>
        </s:Envelope>";

        public const string STREAM_URI_QUERY_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <GetStreamUri xmlns=""http://www.onvif.org/ver{5}/media/wsdl"">
                    <StreamSetup>
                        <Stream xmlns=""http://www.onvif.org/ver{5}/schema"">RTP-Unicast</Stream>
                        <Transport xmlns=""http://www.onvif.org/ver{5}/schema"">
                            <Protocol>UDP</Protocol>
                        </Transport>
                    </StreamSetup>
                    <ProfileToken>{4}</ProfileToken>
                </GetStreamUri>
            </s:Body>
        </s:Envelope>";


        public const string CONTINUOUS_MOVE_PTZ_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <tptz:ContinuousMove xmlns:tptz=""http://www.onvif.org/ver{5}/ptz/wsdl"">
                    <tptz:ProfileToken>{4}</tptz:ProfileToken>
                        <tptz:Velocity>
                            <tt:PanTilt x=""{6}"" y=""{7}"" />
                            <tt:Zoom x=""{8}"" />
                    </tptz:Velocity>
                </tptz:ContinuousMove>
            </s:Body>
        </s:Envelope>";

        public const string PTZ_PRESET_QUERY_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <tptz:GetPresets xmlns:tptz=""http://www.onvif.org/ver{5}/ptz/wsdl"">
                    <tptz:ProfileToken>{4}</tptz:ProfileToken>
                </tptz:GetPresets>
            </s:Body>
        </s:Envelope>";

        public const string PTZ_PRESET_GOTO_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <tptz:GotoPreset>
				    <tptz:ProfileToken>{4}</tptz:ProfileToken>
				    <tptz:PresetToken>{6}</tptz:PresetToken>
			    </tptz:GotoPreset>
            </s:Body>
        </s:Envelope>";

        public const string PTZ_PRESET_SET_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <tptz:SetPreset>
                    <tptz:ProfileToken>{4}</tptz:ProfileToken>
                    <tptz:PresetName>{6}</tptz:PresetName>
                    <tptz:PresetToken>{7}</tptz:PresetToken>
                </tptz:SetPreset>
            </s:Body>
        </s:Envelope>";

        public const string PTZ_PRESET_REMOVE_MESSAGE =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"" 
                      xmlns:tds=""http://www.onvif.org/ver{5}/device/wsdl"" 
                      xmlns:tt=""http://www.onvif.org/ver{5}/schema"">
            <s:Header xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                <wsse:Security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"" 
                               xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
                    <wsse:UsernameToken> 
                        <wsse:Username>{0}</wsse:Username>
                        <wsse:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{1}</wsse:Password>
                        <wsse:Nonce>{2}</wsse:Nonce> 
                        <wsu:Created>{3}</wsu:Created>
                    </wsse:UsernameToken>
                 </wsse:Security>
            </s:Header>
            <s:Body>
                <tptz:RemovePreset>
                    <tptz:ProfileToken>{4}</tptz:ProfileToken>
                    <tptz:PresetToken>{6}</tptz:PresetToken>
                </tptz:RemovePreset>
            </s:Body>
        </s:Envelope>";
    }
}
